
import java.io.Closeable;
import java.util.Scanner;

import org.hibernate.*;
import org.hibernate.cfg.*;

public class TabInsert 
{
	public static void main(String[] args)
	{
		//creating configuration
		Configuration conf= new Configuration();
		conf.configure("hibernate.cfg.xml");
		
		
		

		//creating SessionFactory
		@SuppressWarnings("deprecation")
		SessionFactory factory = conf.buildSessionFactory();
		Session session = factory.openSession();

		//creating Session
		
		for( int i=0; i < 10 ; i++){
	
		//creating an object
			Scanner keyboard = new Scanner(System.in);
			
		AppData App = new AppData();
		
		
		System.out.println("enter an Application Id");
		String id = keyboard.nextLine();
		
		
		System.out.println("enter an Application IP");
		String ip = keyboard.nextLine();
		System.out.println("enter an Application Name");
		String name = keyboard.nextLine();
		System.out.println("enter an Application Short Name");
		String shortName = keyboard.nextLine();
		System.out.println("enter an Application Owner");
		String appowner = keyboard.nextLine();
		System.out.println("enter an integer");
		int ind = keyboard.nextInt();
		
	
		
		
		App.setAppIp(ip);
		
		
		App.setAppName(name);
		
		
		App.setAppShortName(shortName);
		
		
		App.setOwner(appowner);
		
		App.setActive_Ind(ind);
		
		
		App.setAppId(id);
		
		keyboard.close();
		
		
		Transaction tx = session.beginTransaction();
		//inserting record
		session.save(App);
		
		
		
		

		
		tx.commit();
		
		System.out.println("Object saved Succssfully");
		System.out.println();
		}
		session.close();
		factory.close();
	}//main
}//class
